<html>
<head  >
    <!--问卷名-->
    <title>
        {$naire.name}
    </title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <!--css样式-->
    <link type="text/css" rel="stylesheet" href="https://www.wjx.cn/joinnew/css/NewDefault.css?v=12">
    <link href="https://www.wjx.cn/joinnew/css/q.css?v=11" rel="stylesheet" type="text/css">
    <link href="https://www.wjx.cn/joinnew/css/newsolid_38.css?v=2" rel="stylesheet" type="text/css">
    <!--结束-->
    <link rel="stylesheet"  href="__STATIC__/layui/css/layui.css" media="all">
</head>

<body style="">

<div id="divNotRun" style="height:100px; text-align:center; display:none;"></div>
<div id="jqContent" class="" style="text-align: left; ">
    <div id="mainCss">
        <div id="mainInner">
            <div id="box">
                <div class="survey" style="margin:0px auto;">
                    <div id="ctl00_ContentPlaceHolder1_JQ1_divHead" class="surveyhead" style="border: 0px;">
                        <div id="ctl00_ContentPlaceHolder1_JQ1_h1Name" style="position:relative;">
                            <h1 id="ctl00_ContentPlaceHolder1_JQ1_lblQuestionnaireName">{$naire.name}</h1>
                        </div>
                        <div style="clear: both;">
                        </div>
                        <div style="clear: both;">
                        </div>
                    </div>

                    <div id="ctl00_ContentPlaceHolder1_JQ1_question" class="surveycontent">
                        <!--剩余时间开始-->
                        <!--剩余时间结束-->

                        <div id="ctl00_ContentPlaceHolder1_JQ1_surveyContent">
                            <fieldset class="fieldset" id="fieldset1">
                              {$html}
                            </fieldset>
                        </div>
                        <div class="shopcart" id="shopcart" style="display:none;">
                        </div>
                    </div>



                    <div style="clear: both;">
                    </div>
                    <div id="divTimeUp" style="display:none;">
                        <div style="padding:10px;overflow:auto;line-height:20px;font-size:16px;text-align:center;"
                             id="divTimeUpTip"></div>
                    </div>
                    <div id="divDescPop" style="display:none;">
                        <div style="padding:10px;  overflow:auto;line-height:20px;font-size:14px;"
                             id="divDescPopData"></div>
                    </div>
                    <div id="rbbox" style="display:none; height:70px;position:fixed;_position:absolute;">


                    </div>


                    <div style="clear: both;">
                    </div>
                </div>


                <div style="margin:30px auto 0; padding-top:30px; overflow: hidden; width:100%;">
                    <div style="border-top: 1px solid #bbbbbb; font-size: 0; height: 1px; line-height: 1px;
                            width: 98%; margin: 0 auto;">
                    </div>
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tbody>
                        <tr>
                            <td height="10px">
                            </td>
                        </tr>
                        <tr>
                            <td align="center" valign="middle">
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tbody>
                                    <tr id="ctl00_trCopy">
                                        <td align="center"
                                            style="font-size: 12px; font-family: Tahoma, 宋体; color: #666666;">

                                        </td>
                                    </tr>

                                    <tr id="ctl00_trPoweredBy">
                                        <td style="color: #666666; font-family: Tahoma, 宋体;" align="center">
                                            <div style="height: 10px;">
                                            </div>
                                            <div id="divBannerLogo"><span id="ctl00_lblPowerby"><a
                                                    href="http://www.cdwuxuan.com/" target="_blank" class="link-444"
                                                    title="无轩网络">无轩网络</a>&nbsp;提供技术支持</span></div>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td>

                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </td>
                        </tr>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div style="clear: both;">
        </div>
    </div>
</div>

<div style="clear:both;"></div>
<script src="__STATIC__/layui/layui.js"></script>
<script>
    //进入时选择分类
    var choose={:empty($naire['category'][0]['name'])?0:1};
    if(choose){
        layui.use('layer',function(){
            var layer=layui.layer;
            var $=layui.$;
            layer.open({
                type: 2,
                title: '请选择',
                shadeClose: false,
                shade: true,
                closeBtn:false,
                offset: '100px',
                area:['500px','400px'],
                maxmin: false, //开启最大化最小化按钮
                content:"{:url('answer/choose',['id'=>$naire.id])}"
            });
        })
    }
    layui.use(['form','layer'], function(){
        var form=layui.form;
        var layer=layui.layer;
        window.$=layui.$;
        $('#submit').click(function(){
            var radio=$('[type=radio]');
            var checkbox=$('[type=checkbox]');
            var name=[];
            radio.each(function(i,k){
                var attrName=$(k).attr('name');
               if(name.indexOf(attrName)==-1){
                   name.push(attrName)
               }
            });
            checkbox.each(function(i,k){
                var attrName=$(k).attr('name');
                if(name.indexOf(attrName)==-1){
                    name.push(attrName)
                }
            });
            var allowSubmit=true;
            name.forEach(function(attrName){
                var len=$('[name="'+attrName+'"]:checked').length;
                if(len==0){
                    layer.msg('有选项没有被选择',{icon:5,offset: '100px'});
                    allowSubmit=false;
                }
            });

            $('input[type=text]').each(function(i,dom){
                if($(dom).val().length<1){
                    layer.msg('没有输入值',{icon:5,offset: '100px'});
                    allowSubmit=false;
                }
            });

            if(allowSubmit){
                var form=$('#accept');
                var l=$(form).serializeArray();
               $.post("{:url('answer/accept')}",l,function(response){
                    if(response.code==0){
                        layer.msg('提交成功',{
                            offset: '100px'
                        });
                        setTimeout(function(){
                            location.reload();
                        },1000);
                    }
               })
            }
            return false;
        })
    })
</script>
</body>
</html>